##########################
# Milking related events #
##########################

namespace = DWCMMilk

#.010 Initialize or update hucow related variables
character_event = {
	id = DWCMMilk.010
	hide_window = yes
	only_playable = yes
	min_age = 16
	only_women = yes
	
	is_triggered_only = yes

	trigger = {
		trait = hucow
		is_alive = yes
	}

	immediate = {
		if = { # We initialize the hucow caracteristics if they aren't already (ie. if trait was added with console command)
			limit = { 
				NOT = { has_character_flag = dwcm_hucow_variables_initialized }
			}
			dwcm_become_hucow = yes
		} 
		else = { # If the hucow has her caracteristics correctly initialized, we just update them
			dwcm_update_milk_variables = yes
		}
	}
}


#.020 Yearly current_milk_quantity increase
character_event = {
	id = DWCMMilk.020
	hide_window = yes
	only_playable = yes
	min_age = 16
	only_women = yes

	is_triggered_only = yes

	trigger = {
		has_character_flag = dwcm_hucow_variables_initialized
		trait = hucow
		is_alive = yes
	}

	immediate = {
		character_event = { id = DWCMMilk.030 days = 15 }
		character_event = { id = DWCMMilk.030 days = 45 }
		character_event = { id = DWCMMilk.030 days = 75 }
		character_event = { id = DWCMMilk.030 days = 105 }
		character_event = { id = DWCMMilk.030 days = 135 }
		character_event = { id = DWCMMilk.030 days = 165 }
		character_event = { id = DWCMMilk.030 days = 195 }
		character_event = { id = DWCMMilk.030 days = 225 }
		character_event = { id = DWCMMilk.030 days = 255 }
		character_event = { id = DWCMMilk.030 days = 285 }
		character_event = { id = DWCMMilk.030 days = 315 }
		character_event = { id = DWCMMilk.030 days = 345 }
	}
}


#.030 Monthly current_milk_quantity increase
character_event = {
	id = DWCMMilk.030
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		has_character_flag = dwcm_hucow_variables_initialized
		trait = hucow
		is_alive = yes
	}

	immediate = {
		dwcm_update_milk_variables = yes
		dwcm_increase_current_milk_quantity = yes
		character_event = { id = DWCMMilk.050}
	}
}


#.040 Self Milking event
character_event = {
	id = DWCMMilk.040
  	desc = "DWCMMilk040_desc"
  	picture = hucow_milking
  	title = "dwcm_hucow_milking_title"

  	is_triggered_only = yes # triggered via decision dwcm_hucow_milking

  	option = {
		name = "DWCMMilk040A" # I will have to do it again!
		dcwm_milk_quarter_effect = yes
  	}
  	option = {
        trigger = {
			OR= {
				location = {has_building = dwcm_milkbarn_tr}
				location = {has_building = dwcm_milkbarn_ca}
				location = {has_building = dwcm_milkbarn_ci}
				location = {has_building = dwcm_milkbarn_mr}
			}
		}
		name = "DWCMMilk040B" # Barn - Milk fully!
		dcwm_milk_all_barn_effect = yes
  	}
  	option = {
        trigger = {
			OR= {
				location = {has_building = dwcm_milkbarn_tr}
				location = {has_building = dwcm_milkbarn_ca}
				location = {has_building = dwcm_milkbarn_ci}
				location = {has_building = dwcm_milkbarn_mr}
			}
		}
		name = "DWCMMilk040C" # Barn - Milk fully and sell!
		dcwm_milk_all_barn_wealth_effect = yes
	}
  	option = {
        trigger = {
			in_command = yes
		}
		name = "DWCMMilk040D" # Troops - Milk fully and buff troops!
		dcwm_milk_all_troops_effect = yes
	}
}


#.050 Get engorged breasts
character_event = {
	id = DWCMMilk.050
  	desc = "DWCMMilk050_desc"
  	picture = hucow_engorged_breasts
	title = "dwcm_hucow_engorged_breasts_title"
	only_women = yes

	is_triggered_only = yes

	trigger = {
		has_character_flag = dwcm_hucow_variables_initialized
		NOT = { 
			trait = engorged_breasts
		}
		trait = hucow
		check_variable = { which = dwcm_milk_quantity_CURRENT which = dwcm_milk_capacity_Engorged}
	}

  	option = {
		name = "DWCMMilk050A" # Maybe I should milk myself soon
		add_trait = engorged_breasts
  	}
	
  	option = {
		name = "DWCMMilk050B" # Why wait I should milk myself now
		add_trait = engorged_breasts
		character_event = { id = DWCMMilk.040 }
  	}
}



